package core;

import org.jdom.Element;

public class Category extends Savable {
	private int id;
	private String name;

	public Category(Element elt, int _id, String _name) {
		super(elt);
		this.id = _id;
		this.name = _name;
	}

	public void save(boolean saveXml) {
		if (super.xmlNode == null) {
			System.err.println("Error: xmlNode == null. Can't save Category!\n");
			return;
		}
		xmlNode.setAttribute("id", Integer.toString(id));
		xmlNode.setAttribute("name", name);
		if (saveXml)
			XmlEngine.get().save();
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}
